#include "ThreadPool.hpp"
#include "Task.hpp"
#include <unistd.h>

int main()
{

    ThreadPool<Task>::GetInstance()->Start();
    // std::unique_ptr<ThreadPool<int>> tp(new ThreadPool<int>());

    srand((uint64_t)time(nullptr) ^ getpid());
    // 循环添加任务
    while (1)
    {
        int x = rand() % 100 + 1;
        usleep(1000);
        int y = rand() % 200;

        usleep(1000);
        char oper = opers[rand() % opers.size()];

        Task t(x, y, oper);

        ThreadPool<Task>::GetInstance()->Push(t);
        // 爆发式增长的任务！！！

        ThreadPool<Task>::GetInstance()->Push(t);
        ThreadPool<Task>::GetInstance()->Push(t);
        ThreadPool<Task>::GetInstance()->Push(t);
        ThreadPool<Task>::GetInstance()->Push(t);
    }
    ThreadPool<Task>::GetInstance()->Wait();
}